package icu.lyt0628;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.GenericOptionsParser;

import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Upload {

    public static void main(String[] args) {

        App app = new App();
        app.connect();

        Scanner scan = new Scanner(System.in);
        PrintStream o = System.out;

        o.println("Please input src file path:  ");
        String src = scan.nextLine();
        o.println("Please input dst file path:  ");
        String dst = scan.nextLine();

        if (app.exists(dst)){
            o.println("dst file is existing, whether to overwrite ?(yes/no)");
            String s = scan.nextLine();
            if (s.contains("yes")){
                app.upload(src, dst);
                o.println("file uploaded");
            }else if (s.contains("no")){
                return;
            }
            else {
                o.println("please input yes or no");
            }



        }else {
            app.upload(src, dst);
            o.println("file uploaded");
        }

        app.release();
    }
}
